﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mahanet.Abyss.PathCalculation
{
	public class Coordinate3D
	{
		#region C'tor

		public Coordinate3D(double x, double y, double z)
		{
			this.X = x;
			this.Y = y;
			this.Z = z;
		}

		#endregion

		#region Public Properties

		public double X { get; private set; }
		public double Y { get; private set; }
		public double Z { get; private set; }

		#endregion

		#region Public Methods

		public static Vector3D operator -(Coordinate3D a, Coordinate3D b)
		{
			return new Vector3D(a.X - b.X, a.Y - b.Y, a.Z - b.Z);
		}

		public double DistanceTo(Coordinate3D other)
		{
			return (this - other).Length();
		}

		public override string ToString()
		{
			return string.Format("({0}, {1}, {2})", X, Y, Z);
		}

		#endregion
	}
}
